package com.bgs.service.impl;
import com.bgs.common.R;
import com.bgs.feign.ZeroFeign;
import com.bgs.mapper.DetailOrPictureMapper;
import com.bgs.pojo.vo.DetailOrPicture;
import com.bgs.pojo.vo.OneBeforUserAndStore;
import com.bgs.service.DetailOrPictureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

@Service
public class DetailOrPictureServiceImpl implements DetailOrPictureService {
    @Resource
    private DetailOrPictureMapper detailOrPictureMapper;
    @Autowired
    private ZeroFeign zeroFeign;
    @Override
    public List<DetailOrPicture> OneGetDetailId(Integer orderDetailId) {

        List<DetailOrPicture> detailOrPicture = detailOrPictureMapper.OneGetDetailId(orderDetailId);
        detailOrPicture.stream().forEach(x->{
            OneBeforUserAndStore obuas = zeroFeign.OneGetBeforUserId(x.getStoreId());
            x.setObuas(obuas);
        });
        /*
        * 1.根据商品查询店铺id
        * 2.根据店铺id查询用户
        * */
        //R r = zeroFeign.OneGetBeforUserId(detailOrPictures.get(0).getStoreId());
        return detailOrPicture;
    }
}
